package com.jinzecloud.fiction.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jinzecloud.fiction.bean.TbUserRoleRelevance;
import com.jinzecloud.fiction.service.TbUserRoleRelevanceService;
import com.jinzecloud.fiction.utils.PageUtils;
import com.jinzecloud.fiction.utils.R;



/**
 * 用户角色表
 *
 * @author ??
 * @email 1971240051@qq.com
 * @date 2023-10-19 19:38:04
 */
@RestController
@RequestMapping("fiction/tbuserrolerelevance")
public class TbUserRoleRelevanceController {
    @Autowired
    private TbUserRoleRelevanceService tbUserRoleRelevanceService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("fiction:tbuserrolerelevance:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbUserRoleRelevanceService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{urId}")
    //@RequiresPermissions("fiction:tbuserrolerelevance:info")
    public R info(@PathVariable("urId") Integer urId){
		TbUserRoleRelevance tbUserRoleRelevance = tbUserRoleRelevanceService.getById(urId);

        return R.ok().put("tbUserRoleRelevance", tbUserRoleRelevance);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("fiction:tbuserrolerelevance:save")
    public R save(@RequestBody TbUserRoleRelevance tbUserRoleRelevance){
		tbUserRoleRelevanceService.save(tbUserRoleRelevance);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("fiction:tbuserrolerelevance:update")
    public R update(@RequestBody TbUserRoleRelevance tbUserRoleRelevance){
		tbUserRoleRelevanceService.updateById(tbUserRoleRelevance);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("fiction:tbuserrolerelevance:delete")
    public R delete(@RequestBody Integer[] urIds){
		tbUserRoleRelevanceService.removeByIds(Arrays.asList(urIds));

        return R.ok();
    }

}
